<template>
  <div class="bgff p20">
    <el-form :inline="true" :model="formInline" class="demo-form-inline mb20">
      <el-form-item>
        <el-input v-model="formInline.input" placeholder="请输入用户名"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search">搜索</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">添加</el-button>
      </el-form-item>
    </el-form>
    <div>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column prop="name" label="客户名称" min-width="120"></el-table-column>
        <el-table-column prop="date" label="客户手机号码" min-width="150"></el-table-column>
        <el-table-column prop="province" label="区域名称" min-width="120"></el-table-column>
        <el-table-column prop="date" label="备用号码" min-width="150"></el-table-column>
        <el-table-column prop="date" label="客户地址" min-width="150"></el-table-column>
        <el-table-column prop="date" label="申请内容" min-width="150"></el-table-column>
        <el-table-column prop="date" label="创建时间" min-width="150"></el-table-column>
        <el-table-column prop="date" label="修改时间" min-width="150"></el-table-column>
        <el-table-column fixed="right" label="操作" width="150">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
            <el-button type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <el-dialog
      title="新建用户"
      :visible.sync="dialogFormVisible"
      :modal="true"
      :modal-append-to-body="false"
    >
      <div style="height:400px;overflow:auto;">
        <el-form :model="form">
          <el-form-item label="用户名" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off" placeholder="请输入用户名"></el-input>
          </el-form-item>
          <el-form-item label="密码" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off" placeholder="请输入密码"></el-input>
          </el-form-item>
          <el-form-item label="手机号" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off" placeholder="请输入手机号"></el-input>
          </el-form-item>
          <el-form-item label="用户类型" :label-width="formLabelWidth">
            <el-select v-model="form.region" placeholder="请选择用户类型">
              <el-option label="用户类型A" value="A"></el-option>
              <el-option label="用户类型B" value="B"></el-option>
              <el-option label="用户类型C" value="C"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="组织机构" :label-width="formLabelWidth">
            <el-input readonly placeholder="请选择组织机构"></el-input>
          </el-form-item>
          <el-form-item label="岗位" :label-width="formLabelWidth">
            <el-input readonly placeholder="请选择岗位"></el-input>
          </el-form-item>
          <el-form-item label="岗位" :label-width="formLabelWidth">
            <el-upload
              class="upload-demo"
              action="https://jsonplaceholder.typicode.com/posts/"
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :file-list="fileList"
              list-type="picture"
            >
              <el-button size="small" type="primary">点击上传</el-button>
              <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
            </el-upload>
          </el-form-item>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "adduser",
  data() {
    return {
      fileList: [],
      formLabelWidth: "100px",
      dialogFormVisible: false,
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      formInline: {
        input: ""
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          role: "普通用户",
          status: "开启",
          phone: "15680529067",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          role: "普通用户",
          status: "开启",
          phone: "15680529067",
          address: "上海市普陀区金沙江路 1517 弄",
          zip: 200333
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          role: "技术员",
          status: "禁用",
          phone: "15680529067",
          address: "上海市普陀区金沙江路 1519 弄",
          zip: 200333
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          role: "代理商",
          status: "禁用",
          phone: "15680529067",
          address: "上海市普陀区金沙江路 1516 弄",
          zip: 200333
        }
      ]
    };
  },
  methods: {
    handleClick(row) {
      console.log(row);
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
